<?php 

foreach($this->vote_info as $thread_id=>$thread){
	$vote_list = array();
	if(count($thread) >= 1){
	global $total_vote_sms, $total_vote_web;
		
		foreach($thread as $phase_id=>$phase){
			$vote_list = array();
			$total_vote_sms = 0;
			$total_vote_web = 0;
			if($phase->vote_enable ==1 && isset($this->photoList[$phase->thid][$phase->pid])){
				$vote_list = $this->photoList[$phase->thid][$phase->pid];
			}
			if(!empty($vote_list)){
			
				foreach($vote_list as $imgObj){
				
					$total_vote_sms=$total_vote_sms + $imgObj->vote_sms_count;
					$total_vote_web=$total_vote_web + $imgObj->vote_web_count;
				}
				reset($vote_list);
			
				//eprint(array(count($vote_list), $total_vote_sms, $total_vote_web));
				// Sort array
				if(is_array($vote_list) && count($vote_list) > 0)
					usort($vote_list, "double_vote_cmp");

				$photo_block_id = $thread_id."_".$phase_id;
				$photo_block_title = "Top 10 ".$phase->thread_name.($phase->phase_name != ""?" - ".$phase->phase_name:"");
			
?>
			<div id="topten" class="event-area">
                <div class="event-header-short">
                    <span class="value"><?=$photo_block_title?></span>
                </div>
                <div class="event-content-short">
                    <ol class="topten">
                    	<?php 
						for($i=0; $i<count($vote_list) && $i<10; $i++){
							$voteObj = $vote_list[$i];
						?>
						<li><a href="http://photo.tamtay.vn/photo/view/<?php echo $voteObj->aid?>"><?php echo $voteObj->album_name." (".$voteObj->t."%)"?></a></li>
                     <?php		
                    	}
                    ?>
                  </ol>
                </div>
                <div class="viewmore"><a target="_blank" href="/event/<?php echo $this->short_cut;?>/votedlist/<?php echo $thread_id;?>/<?php echo $phase_id;?>">Xem hết »</a></div>
            </div>  
					
<?php 
			}
		}
	} // End of If
}// End of for loop ?>